package com.cby.springboot.demo.bean;

import java.util.List;

public class AdminUser {

    private String uid;

    private String userName;

    private String phone;

    private String email;

    private boolean enabled;

    private List<AdminRole> roles;

    public String getUId() {
        return uid;
    }

    public void setUId(String uid) {
        this.uid = uid;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public List<AdminRole> getRoles() {
        return roles;
    }

    public void setRoles(List<AdminRole> roles) {
        this.roles = roles;
    }


    public static AdminUser convert(User user) {
        AdminUser adminUser = new AdminUser();
        adminUser.setUId(user.getUserId());
        adminUser.setUserName(user.getUserName());
        adminUser.setEmail(user.getEmail());
        adminUser.setPhone(user.getPhone());
        adminUser.setEnabled(user.getEnabled() > 0);
        return adminUser;
    }
}
